﻿using MNH.WebApps.Common.Mvc;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace MNH.Yarekoodak.WebApps.Models
{
    public class ExternalLoginConfirmationViewModel
    {
        [Required]
        [Display(Name = "User name")]
        public string UserName { get; set; }
    }

    public class ManageUserViewModel
    {
        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Current password")]
        public string OldPassword { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "New password")]
        public string NewPassword { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirm new password")]
        //[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }
    }

    public class LoginViewModel
    {
        [Required]
        [Display(Name = "User name")]
        public string UserName { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [Display(Name = "Remember me?")]
        public bool RememberMe { get; set; }
    }

    public class RegisterViewModel : BaseEntityModel
    {
        public RegisterViewModel()
        {
            IsAdmin = false;
            IsEnabled = true;
        }

        [Required(ErrorMessage = "*")]
        [Display(Name = "نام")]
        public string Name { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "نام خانوادگی")]
        public string Family { get; set; }

        [Display(Name = "نام پدر")]
        public string FatherName { get; set; }

        public List<SelectListItem> AvailableCertificates
        {
            get
            {
                return new List<SelectListItem>{
                    new SelectListItem{Text="دکترا",Value="دکترا"},
                    new SelectListItem{Text="کارشناسی ارشد",Value="کارشناسی ارشد"},
                    new SelectListItem{Text="کارشناسی",Value="کارشناسی"},
                    new SelectListItem{Text="فوق دیپلم",Value="فوق دیپلم"},
                    new SelectListItem{Text="دیپلم",Value="دیپلم"},
                    new SelectListItem{Text="سیکل",Value="سیکل"},
                    new SelectListItem{Text="بی سواد",Value="بی سواد"},
                    new SelectListItem{Text="حوزوی",Value="حوزوی"},
                };
            }
        }

        [Display(Name = "تحصیلات")]
        public string Certificate { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "کدملی/شناسه ملی")]
        public string NationalCode { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "شخص")]
        public bool IsRealPerson { get; set; }

        [Display(Name = "تلفن همراه")]
        public string Phone { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "نام نمایشی")]
        public string DisplayName { get; set; }

        public bool IsAdmin { get; set; }
        public bool IsEnabled { get; set; }

        [Display(Name = "تصویر")]
        public byte[] Image { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "نام کاربری")]
        public string UserName { get; set; }

        [Required(ErrorMessage = "*")]
        [StringLength(15, ErrorMessage = "حداقل طول", MinimumLength = 5)]
        [DataType(DataType.Password)]
        [Display(Name = "گذرواژه")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "تکرار گذرواژه")]
        //[Compare("Password", ErrorMessage = "گذرواژه با تکرار آن مطابقت ندارد")]
        public string ConfirmPassword { get; set; }
    }
}
